home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
ftp.cs.arizona.edu
/
ftp.cs.arizona.edu.tar
/
ftp.cs.arizona.edu
/
icon
/
newsgrp
/
group92c.txt
/
000058_icon-group-sender _Wed Nov 4 07:05:19 1992.msg
< prev
next >
Wrap
Internet Message Format
|
1993-01-04
|
2KB
Received: by cheltenham.cs.arizona.edu; Wed, 4 Nov 1992 09:05:46 MST
Date: Wed, 4 Nov 92 15:03 MET
From: JANPETER@mpi.nl
Subject: file scanning
To: icon-group@cs.arizona.edu
Message-Id: <01GQRAOSOAB48WWBJA@KUNRC1.URC.KUN.NL>
X-Envelope-To: icon-group@cs.arizona.edu
X-Vms-To: IN%"icon-group@cs.arizona.edu"
Comments: Sent using PMDF-822 V3.0, routing is done by KUNRC1
Status: R
Errors-To: icon-group-errors@cs.arizona.edu
Richard Goerwitz writes:
>One thing that's worth thinking about is whether string scanning could
>be extended to cover files. That would solve your problem. Seems
>like a great idea to me. Really great. It's something the Icon Pro-
>ject has been talking about. Any bright students at the U of Arizona
>looking for class projects :-). Would take some interesting buffering
>and a lot of fseeks. But wouldn't it be neat to have scanning usable
>on character streams as well as strings?
This was somewhat surprising to me, because I already do string
scanning on files. I'll explain how, and I'm eager to receive
comments on the proposed method. The method works great on Ultrix,
and MSDOS (386) platforms, so I gather it's kosher Icon. The basic
tric is to use the ! generator twice.
Suppose we just want to print all successive characters in a text file.
The text file is:
<begin file>
The man the woman the
dog bit hit chose to be free.
<end file>
Now one way to scan the entire file (as if it's one string, so
to speak) is this:
procedure main()
inputfile := open("filename")
!!inputfile ? while write(move(1))
end
the output is:
The man the woman thedog bit hit chose to be free.
If this looks simple, that's because it is simple, but I wonder:
Is this what is meant by scanning a character stream, or have I
understood the problem wrongly?
Jan P. de Ruiter
Max Planck Institute for Psycholinguistics
janpeter@mpi.nl